/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.xhy.sniffer.datacarrier.buffer;

import java.util.List;

/**
 * 队列缓冲区接口。
 */
public interface QueueBuffer<T> {
    /**
     * 将数据保存到队列中。
     *
     * @param data 要添加的数据。
     * @return 如果保存成功，返回 true。
     */
    boolean save(T data);

    /**
     * 设置队列满时的不同策略。
     *
     * @param strategy 当缓冲区满时采用的策略。
     */
    void setStrategy(BufferStrategy strategy);

    /**
     * 从队列中获取现有的数据。
     *
     * @param consumeList 用于存放获取到的数据的列表。
     */
    void obtain(List<T> consumeList);

    /**
     * 获取缓冲区的大小。
     *
     * @return 缓冲区的大小。
     */
    int getBufferSize();
}

